package com.ehome.poct.core.dao.mybatis;

import cn.hutool.core.bean.BeanUtil;
import com.ehome.poct.core.api.dto.order.TestOrderExtendsDTO;
import com.ehome.poct.core.dao.entity.order.TestOrderExtendsDO;
import com.ehome.poct.core.dao.mybatis.mapper.order.TestOrderExtendsMapper;
import com.ehome.poct.core.repository.order.TestOrderExtendsRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

/**
 * @auther: kuiba.peng
 * @date: 2022/11/18 12:10
 * @description:
 */
@Repository
@RequiredArgsConstructor
public class TestOrderExtendsRepositoryImpl implements TestOrderExtendsRepository {

    private final TestOrderExtendsMapper orderExtendsMapper;

    @Override
    public void updateByOrderNo(TestOrderExtendsDTO extendsDTO, String orderNo) {
        TestOrderExtendsDO orderExtendsDO = BeanUtil.copyProperties(extendsDTO, TestOrderExtendsDO.class);
        orderExtendsMapper.updateByTestOrderNo(orderExtendsDO, orderNo);
    }

    @Override
    public void save(TestOrderExtendsDTO extendsDTO) {
        orderExtendsMapper.insert(BeanUtil.copyProperties(extendsDTO, TestOrderExtendsDO.class));
    }
}
